<%- if @saved -%>
  show_empty_messages();
  TracksPages.page_inform('<%=  escape_javascript(t('todos.recurring_deleted_success') + t('todos.recurring_pattern_removed', :count => pluralize(@number_of_todos,t('common.todo')))) %>');
  remove_recurring_todo_from_page();
<%- else -%>
  TracksPages.page_error('<%= t('todos.error_deleting_recurring', :description => @recurring_todo.description) %>');
<%- end -%>

function show_empty_messages() {
  <%- if @active_remaining == 0 -%>
    $('#recurring-todos-empty-nd').show();
  <%- end -%>
  <%- if @completed_remaining == 0 -%>
    $('#completed-empty-nd').show();
  <%- end -%>
}

function remove_recurring_todo_from_page() {
  $('#<%=dom_id(@recurring_todo)%>').slideUp(1000, function() {
    $('#<%=dom_id(@recurring_todo)%>').remove();
  });
}